package com.group.project.hrms.service.impl;

import com.group.project.hrms.entity.FrontLineSupervisorDepts;
import com.group.project.hrms.mapper.FrontLineSupervisorDeptsMapper;
import com.group.project.hrms.service.IFrontLineSupervisorDeptsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class FrontLineSupervisorDeptsService implements IFrontLineSupervisorDeptsService {

    @Autowired
    private FrontLineSupervisorDeptsMapper frontLineSupervisorDeptsMapper;


    @Override
    public int insertFrontLineSupervisorDepts(FrontLineSupervisorDepts frontLineSupervisorDepts) {
        return frontLineSupervisorDeptsMapper.insert(frontLineSupervisorDepts);
    }

    @Override
    public int deleteFrontLineSupervisorDepts(FrontLineSupervisorDepts frontLineSupervisorDepts) {
        return frontLineSupervisorDeptsMapper.deleteByPrimaryKey(frontLineSupervisorDepts);
    }

    @Override
    public int updateFrontLineSupervisorDepts(FrontLineSupervisorDepts frontLineSupervisorDepts) {
        return frontLineSupervisorDeptsMapper.updateByPrimaryKey(frontLineSupervisorDepts);
    }

    @Override
    public FrontLineSupervisorDepts selectOneFrontLineSupervisorDepts(FrontLineSupervisorDepts frontLineSupervisorDepts) {
        return frontLineSupervisorDeptsMapper.selectByPrimaryKey(frontLineSupervisorDepts);
    }

    @Override
    public FrontLineSupervisorDepts selectFrontLineSupervisorDeptsBySID(String sid) {
        Example example = new Example(FrontLineSupervisorDepts.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.orLike("supervisorContactId", sid);
        return frontLineSupervisorDeptsMapper.selectOneByExample(example);
    }

    @Override
    public List<FrontLineSupervisorDepts> selectAllFrontLineSupervisorDepts() {
        return frontLineSupervisorDeptsMapper.selectAll();
    }
}
